package com.example.fszq.volleydemo1.adapters;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.example.fszq.volleydemo1.layout.IndexFragment;

/**
 * Created by fszq on 2016/1/31.
 */
public class IndexFragmentAdapter extends FragmentPagerAdapter {
    public final int COUNT = 3;
    private String[] titles = new String[]{"收藏","板块","同城交易"};
    private Context context;
    //private IndexFragment ifrag = new IndexFragment();

    public IndexFragmentAdapter(FragmentManager fm, Context context) {
        super(fm);
        this.context = context;
    }

    @Override
    public Fragment getItem(int position) {
        //return ifrag.newInstance(position+1);
        return IndexFragment.newInstance(position + 1);
    }

    @Override
    public int getCount() {
        return COUNT;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
